package saeildamil.common;

import java.io.Serializable;

public class Student implements Serializable {
	static int totalStdNum; // 총학생수
	private String stdNum; // 학번
	private String stdName; // 성명
	private int korScore; // 국어
	private int engScore; // 영어
	private int mathScore; // 수학

	public Student(String stdNum, String stdName) {
		this.stdNum = stdNum;
		this.stdName = stdName;
	}

	public Student(String stdNum, String stdName, int korScore, int engScore,
			int mathScore) {
		this.stdNum = stdNum;
		this.stdName = stdName;
		this.korScore = korScore;
		this.engScore = engScore;
		this.mathScore = mathScore;
	}

	public int getTotalScore() {
		return korScore + engScore + mathScore;
	}

	public double getAvg() { // 소수점 두자리
		/*1번째 return (((getTotalScore() / 3.0) * 100) * 0.5f) / 100f;*/
		/*2번째 double avg = getTotalScore() / 3.0 ;
		String result = String.format("%.2f", String.valueOf(avg));
		return Double.parseDouble(result);*/
		//3번째
		return Double.parseDouble(String.format("%.2f", getTotalScore() / 3.0));
	}

	@Override
	public String toString() {
		return "Student [학번=" + stdNum + ", 성명=" + stdName
				+ ", 국어점수=" + korScore + ", 영어점수=" + engScore
				+ ", 수학점수=" + mathScore + ", 총점="
				+ getTotalScore() + ", 평균=" + getAvg() + "]";
	}

	public static int getTotalStdNum() {
		return totalStdNum;
	}

	public static void setTotalStdNum(int totalStdNum) {
		Student.totalStdNum = totalStdNum;
	}

	public String getStdNum() {
		return stdNum;
	}

	public void setStdNum(String stdNum) {
		this.stdNum = stdNum;
	}

	public String getStdName() {
		return stdName;
	}

	public void setStdName(String stdName) {
		this.stdName = stdName;
	}

	public int getKorScore() {
		return korScore;
	}

	public void setKorScore(int korScore) {
		this.korScore = korScore;
	}

	public int getEngScore() {
		return engScore;
	}

	public void setEngScore(int engScore) {
		this.engScore = engScore;
	}

	public int getMathScore() {
		return mathScore;
	}

	public void setMathScore(int mathScore) {
		this.mathScore = mathScore;
	}
	
	

}
